﻿////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// <copyright>Copyright 2008-2011 Andreas Huber Doenni</copyright>
// Distributed under the Microsoft Public License (Ms-PL).
// See accompanying file License.txt or copy at http://mews.codeplex.com/license.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

namespace Mews.Net.Nntp
{
    using System;

    using Mews.Text;

    /// <summary>Is the base class of all commands that retrieve an article or a part thereof.</summary>
    /// <typeparam name="TResponse">The type representing the response.</typeparam>
    /// <threadsafety static="true" instance="false"/>
    public abstract class ArticleContentCommand<TResponse> : SingleLineCommand<TResponse, long, string>
        where TResponse : IResponse
    {
        internal ArticleContentCommand(string command, string messageId, string[] successResponseCodes) :
            base(command + " " + messageId, successResponseCodes)
        {
            CommandHelper.AssertContainsNoWhiteSpace("messageId", messageId);
        }

        internal ArticleContentCommand(string command, long number, string[] successResponseCodes) :
            base(command + " " + StringHelper.ToString(number), successResponseCodes)
        {
            if (number <= 0)
            {
                throw new ArgumentOutOfRangeException("number", ExceptionMessages.PositiveNumberRequired);
            }
        }

        internal ArticleContentCommand(string command, string[] successResponseCodes) :
            base(command, successResponseCodes)
        {
        }
    }
}
